package com.framework.modules.dataview.service.impl;

import com.baomidou.mybatisplus.mapper.Wrapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.common.utils.PageUtils;
import com.framework.common.utils.Query;

import com.framework.modules.dataview.dao.ViewGuildMemberListDao;
import com.framework.modules.dataview.entity.ViewGuildMemberListEntity;
import com.framework.modules.dataview.service.ViewGuildMemberListService;


@Service("viewGuildMemberListService")
public class ViewGuildMemberListServiceImpl extends ServiceImpl<ViewGuildMemberListDao, ViewGuildMemberListEntity> implements ViewGuildMemberListService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Wrapper<ViewGuildMemberListEntity> wrapper = new EntityWrapper<ViewGuildMemberListEntity>();
        if(params.containsKey("nickname")){
            wrapper.like("nickname", params.get("nickname").toString());
        }
        if(params.containsKey("member_uid")){
            wrapper.eq("member_uid",params.get("memberUid"));
        }
        if(params.containsKey("guild_id")){
            wrapper.eq("guild_id",params.get("guild_id"));
        }
        Page<ViewGuildMemberListEntity> page = this.selectPage(
                new Query<ViewGuildMemberListEntity>(params).getPage(),
                wrapper.orderBy("adddate",false)
        );

        return new PageUtils(page);
    }

}
